Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom fields for users - re-targeted against v8 #16100

Open
wants to merge 8 commits into
base: v8
Choose a base branch
from

Conversation

uberbrady
Copy link
Collaborator

This is similar to #13715 - just re-based against the new v8 branch.

This PR has been rebased many, many, many times - so I would expect that it might have acquired some bit-rot during the process.

…the new HasCustomFields trait.

This should allow us to add custom fields to just about anything we want to within Snipe-IT.

Below are the commits that have been squashed together:

Initial decoupling of custom field behavior from Assets for re-use

Add new DB columns to Custom Fields and fieldsets for 'type'

WIP: trying to figure out UI for custom fields for things other than Assets, find problematic places

Real progress towards getting to where this stuff might actually work...

Fix the table-name determining code for Custom Fields

Getting it closer to where Assets at least work

Rename the trait to it's new, even better name

Solid progress on the new Trait!

WIP: HasCustomFields, still working some stuff out

Got some basics working; creating custom fields and stuff

HasCustomFields now validates and saves

Starting to yank the other boilerplate code as things start to work (!)

Got the start of defaultValuesForCustomField() working

More progress (squash me!)

Add migrations for default_values_for_custom_fields table

WIP: more towards hasCustomFields trait

Progress cleaning up the PR, fixing FIXME's

New, passing HasCustomFieldsTrait test!

Fix date formatter helper for custom fields

Fixed more FIXME's
Copy link

what-the-diff bot commented Jan 20, 2025

PR Summary

  • Introduction of Helper Methods for Custom Fields

    • Added new CustomFieldHelper.php file containing methods for handling different operations related to custom fields. This results in a streamlined data handling process.
  • Refactoring of Various Controllers

    • Updated the logic of retrieving, storing, and managing custom fields in AssetsController.php, CustomFieldsetsController.php, UsersController.php and AssetsModelsController.php to further optimize the overall performance.
  • Enhancements of Custom Field Management

    • Introduced changes in CustomFieldsController.php for better management of custom fields, ensuring the right context for fieldset associations.
  • Code Clean-ups

    • Outdated codes and obsolete methods related to default values for custom fields were removed from AssetsController.php and AssetModel.php. This leads to a cleaner, more maintainable codebase and paves the way for new features.
  • Modifications in Data Transformation Logic

    • Changed the logic of transforming custom fields in AssetsTransformer.php and UsersTransformer.php to make use of CustomFieldHelper, achieving more efficient handling of transformation processes.
  • Improvement in Importing Logic

    • Cleaned up the custom field handling logic for asset imports in AssetImporter.php and filled custom fields method in Importer.php for easier understanding and potential improvements.
  • Introduction of New Model, Trait, and Migration Files

    • The addition of DefaultValuesForCustomFields model, HasCustomFields trait, and a few migration files that enable new features and capabilities on managing custom fields more effectively in various models like Asset, AssetModel, and User.
  • Changes in the Presentation Layer

    • Updated AssetPresenter and UserPresenter to directly use CustomFieldHelper, resulting in a more efficient data table layout creation process.
  • Creation of New View Files

    • A new view file custom-fields-view.blade.php was created for better handling of how custom fields are displayed, increasing user interface consistency.
  • Updates in Existing View Files

    • Changes in multiple view files like edit.blade.php and index.blade.php were made necessary for conditional rendering and improved handling of custom fields.
  • Addition of New Unit Test Files

    • Introduced a new unit test file HasCustomFieldsTraitTest.php to test various aspects of custom fields for the Asset model, leading to more reliable software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant